To use CDO,
you need to have the runtime DLL cdo.dll on your system. Normally it’s located in C:\program
files\Common Files\System\Mapi\1033\NT. If it’s not there and you can't find it
anywhere on your machine with Search | For Files or Folders, it means that CDO is not installed
yet. To install it, all you need do is launch Outlook 2000 setup, and check the
CDO box.
If you use Outlook at work, most likely your
Outlook client talks to Exchange Server without you even realizing it. If
Outlook is set up to connect to Microsoft Exchange, which is most likely, then
you don't need to change any settings on your Outlook, and you can skip the
rest of this section. You will still need to ensure IIS is installed on your
machine and that your mail server can be visited from the Internet, covered in
the next section.
Your Outlook set up may be configured for
Internet Mail Only, without having Exchange Server installed. If you use
Outlook at home to check your Internet emails, chances are you have it set up
in this way. To verify this, click Help | About Microsoft Outlook after starting Outlook. If the
About dialog box shows Internet Mail Only, then you know your Outlook doesn't operate in
the client server Exchange configuration we need. If the About dialog box shows
No
E-mail, then you
aren't currently using Outlook as your email application at all. For both these
cases, you will need to setup your mail support for Corporate or Workgroup.
This is because our ASP CDO code won't run successfully unless our logon and
profile is set up for use in a corporate environment, even a fake one.
To make CDO happy, we need to change the email
service option from No E-mail or Internet Mail Only to Corporate or Workgroup, by going to Tools | Options
| Mail Delivery | Reconfigure Mail Support… Then in the Outlook 2000 Startup dialog box,
select Corporate
or Workgroup,
and click Next.
You'll see a message box informing you that Proceeding will
cause all users who use this machine to have this configuration. Just go ahead and click Yes, unless there are indeed other
users using Outlook from the same machine, and then restart Outlook. To set it
back afterwards, simply repeat the above steps up to Reconfigure
Mail Support…,
but this time choose No E-mail or Internet Mail Only as appropriate.
After you restart Outlook, the Help | About
Microsoft Outlook
should now show Corporate or Workgroup. The other indications of the
change are that now you will see Services instead of Accounts in the Outlook Tools menu, and the Main settings in
Control Panel now show Profiles instead of just Internet
accounts.
Still, why are we going through all this
trouble? Because to use CDO, we first need to log on, which requires a profile
name. If you use Internet Mail Only, you don't have a profile for CDO to log on
with.
A word of warning is in order: if you change
your Outlook client from Internet Mail Only to Corporate or Workgroup, and then add a new profile for
your Internet mail accounts, be careful! Before you add a new profile and use
it, you'd be wise to save your emails and anything in other Outlook folders as
your new profile may make the messages in your previous setting inaccessible.
ASP is
included in IIS 3.0 or above. You don't need to change any settings after you
install IIS 4.0 on NT 4 or IIS 5.0 on Windows 2000. The following lines can be
placed in an ASP file (don't forget to insert the profile name your Outlook
uses when starting, find it from Control Panel | Mail | Show Profiles…) to test your setup:
<%
set Session("objsession") = Server.CreateObject("MAPI.Session")
rem there are two ways to test CDO with IIS/ASP – both use the CDO Logon method.
rem On NT 4, either method will work fine; on Win2K, only the 2nd method works.
rem first, use a profile name with the Logon method
Session("objsession").Logon("your default profile")
rem if the above line doesn’t work, comment it and uncomment the following lines rem Session("objsession").Logon "", "", False, True, 0, True,
rem "exchangeServerName" & vbLF & "exchangeE-MailName"
%>
If this
runs without error, then great, your system is correctly configured for running
ASP/CDO applications. If however, it doesn't work as it should, choose View Source in your browser, and if the above
lines have generated the error Collaboration Data Objects – [MAPI_E_LOGON_FAILED
(80040111)],
then it indicates you're dealing with a tricky beast: IIS authentication
failure. To resolve this issue, you have to set the Anonymous User on IIS to
your Outlook machine's logon name. For example, if you use the user name
Administrator to log on to your NT/Outlook/IIS machine, then open the IIS
Internet Service Manager. Go to Default Web Site Properties | Directory Security
| Anonymous Access and Authentication Control | Edit. In the Authentication Methods
dialog box, the Allow Anonymous Access option should be enabled. Click on
the Edit button beside it, change the
Anonymous Username to the built-in Guest account of your login domain – or if
you use Outlook at home and don’t have a domain, you’ll have to use your logon
name. Now when you run the above ASP code, you shouldn't see any error
messages.
I've not
found ASP-based code to be well suited to uploading recorded messages, so I
have used JSP code for this task. Setting up a test Java web server is not too
difficult and the effort required is worthwhile in the long run. Here are the
steps you need to follow:
1. If you
don't have JDK 1.2, download it from http://java.sun.com/j2ee/download.html.
2. Download
the JavaServer Web Development Kit (JSWDK) 1.0 if you don't already have a JSP
server installed.
3. After
installing JDK and JSWDK, open the file webserver.xml in the JSWDK home directory and
check the default port number 8080. You will need to use this port number when
requesting documents from your JSP server. Also, note the following line:
<WebApplication id="voice" mapping="/voice " docBase="voice"/>
in the <WebServer> <Service> element to indicate where to look for voice files. Of course, you'll need to create the directory voice inside the installed JSWDK directory.